package com.sky.dao;

import com.sky.util.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
    DBConnection DBConn = new DBConnection();
    public boolean CheckLogin(String s1,String s2) throws SQLException {
        //conn对象 代表了MySQL数据库sky连接
        Connection conn = DBConn.getConn();
        Statement stmt = conn.createStatement();
        ResultSet rs = null;//结果集
        boolean OK = true;//t登录成功 f登陆失败
        // todo 密码加密 账户密码过滤
        String sql = "select * from admin where"+"AdminName="+s1+" and AdminPwd="+ s2 ;
        rs = stmt.executeQuery(sql);//执行sql语句
        if(!rs.next()){
            OK = false;
        }
        return OK;
    }
}
